import { defineStore } from "pinia";
import { ref } from "vue";

export const useExampleStore = defineStore(
  "example",
  () => {
    const count = ref(0);

    function countAdd(val) {
      count.value += val;
    }

    function getCount() {
      return count.value;
    }

    return {
      count,
      getCount,
      countAdd,
    };
  },
  {
    persist: true, // 开启持久化
  }
);
